import React, { PureComponent } from 'react';
import { Upload, message } from 'antd';
import { PrimaryC, UploadC } from '../../../comps';

import { connect } from 'dva';

@connect(({ userM: user }) => ({
  user,
}))
export default class UploadImport extends PureComponent {
  state = {};

  // helperRender

  render() {
    const { that, primaryProps } = this.props;
    return (
      <UploadC
        title={'导入'}
        type={1}
        accept='.txt,.xlsx,.xls'
        showUploadList={false}
        action='gateway/file/maat-server/api/v1/taDataImport/uploadTADateImport'
        onUpload={(e) => {
          if (e.message == '成功') {
            that.uploadImportSuccess();
            message.success(`文件上传成功`);
          } else {
            message.error(e.message || '文件上传失败');
          }
        }}
        style={{ display: 'inline', margin: '5px' }}
        primaryProps={primaryProps}
      />
    );
  }
}
